//
//  SEGActivityManager.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/8/1.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGActivityManager.h"

static NSString *actRoot = @"/act-api";
static NSString *pageSize = @"15";

@implementation SEGActivityManager

/**
 * 查询活动列表
 * @author Wendy
 * @param isMine 是否查询我参与的活动
 * @param isRecommend 是否推荐状态
 * @param finished 回调结果
 */
- (void)requestQueryActivitysWithIsMine:(BOOL)isMine
                            isRecommend:(BOOL)isRecommend
                                 pageNo:(NSInteger)pageNo
                               finished:(SEGNetworkReponse)finished
{
    //是否查询我参与的活动1:是2:否
    NSString *isMineString = isMine ? @"1" : @"2";
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* tempDict = @{
                               @"userId" : kAccountUserID,
                               @"communityId" : kAccountCommunityID,
                               @"provinceId" : ValueToString(profile.provinceId),
                               @"cityId" : ValueToString(profile.cityId),
                               @"region" : ValueToString(profile.regionId),
                               @"isMine" : isMineString,
                               @"pageNo" : @(pageNo)
                               };
    
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:tempDict];
    if (isRecommend) {
        [params setObject:@"2" forKey:@"isRecommend"];//2:已推荐。若传此参数则查询推荐活动列表
    }
    __block NSInteger _pageNo = pageNo;
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/act-api/activityInfo/queryActivitys.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage){
                                                 if (isSuccessed) {
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     NSArray* list = [dicData valueForKey:@"list"];
                                                     
                                                     if (!list || ![list isKindOfClass:[NSArray class]]) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     if (_pageNo != 1 && [list isKindOfClass:[NSArray class]] && list.count == 0) {
                                                         if (isRecommend) {
                                                             finished(NO, result, codeType, @"试试左滑，发现更多精彩活动！");
                                                         }else {
                                                             finished(NO, result, codeType, @"没有更多的数据！");
                                                         }
                                                         return;
                                                     }
                                                     
                                                     NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:list.count];
                                                     for (NSDictionary* dic in list) {
                                                         SEGActivityListModel* _model = [SEGActivityListModel initWithDictionary:dic];
                                                         [arrM addObject:_model];
                                                     }
                                                     
                                                     if (_pageNo == 1) { //顶部刷新
                                                         self.activityList = @[];
                                                     }
                                                     
                                                     NSMutableArray* _tmpData = [NSMutableArray arrayWithArray:self.activityList];
                                                     [_tmpData addObjectsFromArray:arrM];
                                                     
                                                     self.activityList = _tmpData;
                                                     
                                                     finished(YES, result, codeType, errorMessage);
                                                 }else {
                                                     finished(NO, result, codeType, errorMessage);
                                                 }
                                             }];
}

/**
 * 查询活动详情
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestQueryActivityWithActId:(NSString *)actId finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"actId" : actId
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/act-api/activityInfo/queryActivityById.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     NSDictionary* actDict = [dicData valueForKey:@"act"];
                                                     if (actDict && [actDict isKindOfClass:[NSDictionary class]]) {
                                                         self.detailModel = [SEGActivityDetailModel initWithDictionary:actDict];
                                                         finished(YES, result, codeType, errorMessage);
                                                     }else {
                                                         finished(NO, result, codeType, errorMessage);
                                                     }
                                                 }else {
                                                     finished(NO, result, codeType, errorMessage);
                                                 }
                                             }];
}

/**
 * 活动浏览详情/分享活动/给活动点赞
 * @author Wendy
 * @param actId 是否查询我参与的活动1:是2:否
 * @param actionType 动作类型1:浏览,2:点赞,3:分享
 * @param finished 回调结果
 */
- (void)requestBrowseSharePraiseWithActId:(NSString *)actId actionType:(NSString *)actionType finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"communityId" : kAccountCommunityID,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId),
                             @"actId" : actId,
                             @"actionType" : actionType
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/act-api/actvityBehavior/browseSharePraise.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     if ([actionType isEqualToString:@"2"]) {
                                                         [[SEGAnalyseBehaviorManager sharedManager] requestIntegralGrowthWithCode:SEGIntegralCode.like finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
                                                             
                                                         }];
                                                     }
                                                     
                                                     NSString* likeCount = [dicData valueForKey:@"likeCount"];
                                                     if (likeCount) {
                                                         self.likeCount = ValueToString(likeCount);
                                                         finished(YES, result, codeType, errorMessage);
                                                         return;
                                                     }else {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                 }else {
                                                     finished(NO, result, codeType, errorMessage);
                                                 }
                                             }];
}

/**
 * 查询活动评论列表
 * @author Wendy
 * @param objId  活动ID
 * @param pageNo  页码
 */
- (void)requestActivityCommentsListByObjId:(NSString*)objId
                                    pageNo:(NSInteger)pageNo
                                  Finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"objId" : objId,
                             @"objType" : @"6",//活动默认参数
                             @"pageNo" : @(pageNo),
                             @"pageSize" : pageSize,
                             @"userId" : kAccountUserID
                             };
    
    __block NSInteger _pageNo = pageNo;
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/quiz/findPictorialQuizList.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     NSArray* pictQuizList = [dicData valueForKey:@"pictQuizList"];
                                                     
                                                     if (!pictQuizList || ![pictQuizList isKindOfClass:[NSArray class]]) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     
                                                     if (_pageNo != 1 && [pictQuizList isKindOfClass:[NSArray class]] && pictQuizList.count == 0) {
                                                         finished(NO, result, codeType, @"没有更多的数据！");
                                                         return;
                                                     }
                                                     
                                                     NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:pictQuizList.count];
                                                     NSString* userIds = @"";
                                                     for (NSDictionary* dic in pictQuizList) {
                                                         SEGActivityDetailCommentModel* _model = [SEGActivityDetailCommentModel initWithDictionary:dic];
                                                         [arrM addObject:_model];
                                                         userIds = [userIds stringByAppendingString:[NSString stringWithFormat:@",%@",_model.userId]];
                                                     }
                                                     
                                                     if (_pageNo == 1) { //顶部刷新
                                                         self.commentsArray = @[];
                                                     }
                                                     
                                                     NSMutableArray* _tmpData = [NSMutableArray arrayWithArray:self.commentsArray];
                                                     [_tmpData addObjectsFromArray:arrM];
                                                     
                                                     self.commentsArray = _tmpData;
                                                     
                                                     if ([userIds length] > 0) {
                                                         userIds = [userIds substringFromIndex:1];
                                                     }
                                                     finished(YES, result, codeType, userIds);
                                                 }else {
                                                     finished(NO, result, codeType, errorMessage);
                                                 }
                                             }];
}

/**
 * 活动进行评论
 * @author Wendy
 * @param objId 活动ID
 * @param quizContent 评论内容
 * @param quizPic 图片
 * @param show 0:不显示 1：显示
 * @param finished 回调结果
 */
- (void)requestCommentActivityWithObjId:(NSString *)objId
                            quizContent:(NSString *)quizContent
                                quizPic:(NSString *)quizPic
                                   show:(NSString *)show
                               finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSString* communityName = [NSString stringWithFormat:@"来自%@ %@", profile.city, profile.communityName];
    
    NSDictionary* params = @{
                             @"objId" : objId,
                             @"communityName" : communityName,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId),
                             @"quizContent" : quizContent,
                             @"quizPic" : quizPic,
                             @"show" : show,
                             @"objType" : @"6",
                             @"quizTypeId" : @"90000",
                             };

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/comment/api/save",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             if (isSuccessed) {
                                                 [[SEGAnalyseBehaviorManager sharedManager] requestIntegralGrowthWithCode:SEGIntegralCode.reply finished:^(BOOL isSuccessed, id result, NSString* codeType, NSString* errorMessage) {
                                                 }];
                                                 finished(YES, result, codeType, errorMessage);
                                             }else {
                                                 finished(NO, result, codeType, errorMessage);
                                             }
                                         }];
}

/**
 * 查询活动评论详情
 * @author Wendy
 * @param quizId  评论ID
 */
- (void)requestActivityCommentDetailByQuizId:(NSString*)quizId
                                    Finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"quizId" : quizId,
                             @"userId" : kAccountUserID
                             };

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/quiz/quizDetail.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             NSString* code = codeType;
                                             NSString* message = errorMessage;
                                             if (isSuccessed) {
                                                 
                                                 NSDictionary* dicData = [result valueForKey:@"data"];
                                                 
                                                 if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                                 
                                                 NSDictionary* data = [dicData valueForKey:@"quizDto"];
                                                 
                                                 if (data && [data isKindOfClass:[NSDictionary class]]) {
                                                 
                                                     self.commentDetailModel = [SEGActivityDetailCommentDetailModel initWithDictionary:data];
                                                     
                                                     // 通过传递userId来请求相关的积分
                                                     message = self.commentDetailModel.userId;
                                                     
                                                     finished(YES, result, code, message);
                                                     return;
                                                 }else {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                             }else {
                                                 finished(NO, result, codeType, errorMessage);
                                             }
                                         }];
}

/**
 * 查询活动评论的回复列表
 * @author Wendy
 * @param quizId  评论ID
 * @param pageNo  页码
 */
- (void)requestQuizAnswListByQuizId:(NSString*)quizId pageNo:(NSInteger)pageNo Finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"quizId" : quizId,
                             @"pageNo" : @(pageNo),
                             @"pageSize" : pageSize,
                             @"userId" : kAccountUserID
                             //@"objType" : objType 废弃不要了
                             };
    
    __block NSInteger _pageNo = pageNo;

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/cms-api/quiz/quizAnswList.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             
                                             NSString* code = codeType;
                                             NSString* message = errorMessage;
                                             
                                             if (isSuccessed) {
                                                 
                                                 NSDictionary* dicData = [result valueForKey:@"data"];
                                                 if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                                 NSArray* answList = [dicData valueForKey:@"answList"];
                                                 
                                                 if (!answList || ![answList isKindOfClass:[NSArray class]]) {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                                 
                                                 if (_pageNo != 1 && [answList isKindOfClass:[NSArray class]] && answList.count == 0) {//加载更多时才提示
                                                     finished(NO, result, code, @"没有更多的数据！");
                                                     return;
                                                 }
                                                 
                                                 NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:answList.count];
                                                 
                                                 NSString* userIds = @"";
                                                 for (NSDictionary* dic in answList) {
                                                     SEGActivityDetailCommentAnswModel* _model = [SEGActivityDetailCommentAnswModel initWithDictionary:dic];
                                                     [arrM addObject:_model];
                                                     userIds = [userIds stringByAppendingString:[NSString stringWithFormat:@",%@",_model.userId]];
                                                 }
                                                 
                                                 
                                                 if (_pageNo == 1) { //顶部刷新
                                                     self.commentAnswerList = @[];
                                                 }
                                                 
                                                 NSMutableArray* _tmpData = [NSMutableArray arrayWithArray:self.commentAnswerList];
                                                 
                                                 [_tmpData addObjectsFromArray:arrM];
                                                 
                                                 self.commentAnswerList = _tmpData;
                                                 
                                                 if ([userIds length] > 0) {
                                                     userIds = [userIds substringFromIndex:1];
                                                 }
                                                 finished(YES, code, userIds, errorMessage);
                                                 return;
                                                 
                                             }else {
                                                 finished(NO, result, codeType, errorMessage);
                                             }
                                         }];
}

/**
 * 回复评论
 * @author Wendy
 * @param quizId  评论ID
 * @param pageNo  页码
 */
- (void)requestSaveQuizAnswerByquizId:(NSString*)quizId
                          answContent:(NSString*)answContent
                           byReviewId:(NSString*)byReviewId
                         byReviewNick:(NSString*)byReviewNick
                       byReviewUserId:(NSString*)byReviewUserId
                      objPicUrlForMsg:(NSString*)objPicUrlForMsg
                       objTitleForMsg:(NSString*)objTitleForMsg
                             objeType:(NSString*)objeType
                          parentObjId:(NSString*)parentObjId
                           paramsType:(NSInteger)paramsType
                        parentObjType:(NSInteger)parentObjType
                             Finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSString* communityName = [NSString stringWithFormat:@"来自%@ %@", profile.city, profile.communityName];
    NSString* communityId = profile.jobCommunity;
    // [bugfix 30213]修复活动评论回复，用户昵称显示错误
    NSString* nickName = profile.nickname;
    if ([nickName length] == 0) {
        nickName = profile.tel;
    }
    
    NSDictionary* tempDict = @{
                               @"quizId" : quizId,
                               @"answContent" : answContent,
                               @"creator" : nickName,
                               @"byReviewId" : byReviewId,
                               @"byReviewUserId" : byReviewUserId,
                               @"communityName" : communityName,
                               @"communityId" : communityId,
                               @"userId" : kAccountUserID,
                               @"objPicUrlForMsg" : objPicUrlForMsg,
                               @"objTitleForMsg" : objTitleForMsg,
                               @"objType" : objeType,//
                               @"parentObjId" : parentObjId,
                               @"parentObjType" : @(parentObjType)
                               };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:tempDict];
    if (paramsType == 0) {//回复评论的评论
        [params setObject:byReviewNick forKey:@"byReviewNick"];
    }
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/quiz/saveQuizAnswer.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             finished(isSuccessed, result, codeType, errorMessage);
                                         }];
}

/**
 * 查询我的评论
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestMyCommentsWithActId:(NSString *)actId
                            pageNo:(NSUInteger)pageNo
                          finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"objId" : actId,
                             @"pageNo" : @(pageNo),
                             @"pageSize" : pageSize,
                             @"objType" : @"6"
                             };
    
    __block NSInteger _pageNo = pageNo;
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/comment/api/myComments",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:GET
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             
                                             NSString* code = codeType;
                                             NSString* message = errorMessage;
                                             
                                             if (isSuccessed) {
                                                 NSDictionary* dicData = [result valueForKey:@"data"];
                                                 if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                                 NSArray* commentsList = [dicData valueForKey:@"commentDtoList"];
                                                 
                                                 if (!commentsList || ![commentsList isKindOfClass:[NSArray class]]) {
                                                     finished(NO, result, code, message);
                                                     return;
                                                 }
                                                 
                                                 if (_pageNo != 1 && [commentsList isKindOfClass:[NSArray class]] && commentsList.count == 0) {
                                                     finished(NO, result, code, @"没有更多的数据！");
                                                     return;
                                                 }
                                                 
                                                 NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:commentsList.count];
                                                 
                                                 for (NSDictionary* dic in commentsList) {
                                                     SEGActivityMyUploadModel* _model = [SEGActivityMyUploadModel initWithDictionary:dic];
                                                     [arrM addObject:_model];
                                                 }
                                                 
                                                 if (_pageNo == 1) { //顶部刷新
                                                     self.myCommentsList = @[];
                                                 }
                                                 
                                                 NSMutableArray* _tmpData = [NSMutableArray arrayWithArray:self.commentAnswerList];
                                                 
                                                 [_tmpData addObjectsFromArray:arrM];
                                                 
                                                 self.myCommentsList = _tmpData;
                                                 
                                                 finished(YES,code, message, errorMessage);
                                                 return;
                                             }else {
                                                 finished(NO, result, codeType, errorMessage);
                                             }
                                         }];
}

/**
 * 检查某个活动是否上传过作品
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestCheckHasUploadedWithActId:(NSString *)actId
                                finished:(SEGNetworkReponse)finished
{
//    NSString *urlString = [NSString stringWithFormat:@"/uhomecp-cbs-api/comment/api/check?objId=%@&objType=6",actId];
    NSDictionary* params = @{
                             @"objId" : actId,
                             @"objType" : @"6"
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/comment/api/check",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:GET
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             if (isSuccessed) {
                                                 
                                                 NSDictionary* dicData = [result valueForKey:@"data"];
                                                 if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                     finished(NO, result, codeType, errorMessage);
                                                     return;
                                                 }
                                                 
                                                 if ([ValueToString([dicData valueForKey:@"code"]) isEqualToString:@"1"]) {
                                                     self.hasUploaded = YES;
                                                 }else {
                                                     self.hasUploaded = NO;
                                                 }
                                                 
                                                 finished(YES, result, codeType, errorMessage);
                                                 return;
                                             }else {
                                                 finished(NO, result, codeType, errorMessage);
                                             }
                                         }];
    
}

/**
 * 对评论点赞
 * @author Wendy
 * @param objId    被点赞或浏览主题对象
 * @param objType  被点赞或浏览主题对象类型 1 画报2问题 3评论 4问题答案
 * @param objPicUrlForMsg  消息图片 主要是 2手 闲置 帮帮
 * @param objTitleForMsg  消息标题,如果是对PGC或者话题等系统发起的 objTitleForMsg为对应的标题，帮帮则为帮帮的标题（即问题的内容）否则objTitleForMsg为 评论内容
 * @param byReviewUserId  被点赞对象的用户ID，即记录创建者的用户Id
 * @param parentObjId    父级Id ，例如对问题答案进行回复的话 parentObjId为问题ID
 * @param parentObjType parentObjType
 * @param operationType 邻里圈类型 邻里圈相关点赞传 其他地方不传
 * @param finished 回调结果
 */
- (void)requestPraiseAttentByObjId:(NSString*)objId
                           ObjType:(NSString*)objType
                   objPicUrlForMsg:(NSString*)objPicUrlForMsg
                    objTitleForMsg:(NSString*)objTitleForMsg
                    byReviewUserId:(NSString*)byReviewUserId
                       parentObjId:(NSString*)parentObjId
                     parentObjType:(NSString*)parentObjType
                     operationType:(NSString *)operationType
                          Finished:(SEGNetworkReponse)finished
{
    NSString* communityName = [NSString stringWithFormat:@"来自%@ %@", kAccountCityName, kAccountCommunityName];
    //字典为空的闪退，数据校验
    NSDictionary* tempDict = @{
                               @"objId" : objId,
                               @"objType" : objType,
                               @"type" : @"1",//点赞固定1
                               @"creator" : kAccountNickName,
                               @"objTitleForMsg" : objTitleForMsg,
                               @"byReviewUserId" : byReviewUserId,
                               @"communityName" : communityName,
                               @"parentObjId" : parentObjId,
                               @"userId" : kAccountUserID,
                               @"parentObjType" : parentObjType
                               };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:tempDict];
    if (objPicUrlForMsg) {
        [params setObject:objPicUrlForMsg forKey:@"objPicUrlForMsg"];
    }
    if (operationType) {
        [params setObject:operationType forKey:@"operationType"];
    }
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/praiseAttent/save.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             if (isSuccessed) {
                                                 [[SEGAnalyseBehaviorManager sharedManager] requestIntegralGrowthWithCode:SEGIntegralCode.like finished:^(BOOL isSuccessed, id result, NSString* codeType, NSString* errorMessage) {
                                                 }];

                                             }
                                             finished(isSuccessed, result, codeType, errorMessage);
                                             
                                         }];

}

/**
 * 取消点赞
 * @author Wendy
 * @param objId 被取消对象ID
 * @param objType 被取消对象类型
 * @param finished 回调结果
 */
- (void)requestCancelPraiseByobjId:(NSString*)objId
                           objType:(NSString*)objType
                          Finished:(SEGNetworkReponse)finished
{
    //字典为空的闪退，数据校验
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"objId" : ValueToString(objId),
                             @"objType" : ValueToString(objType),
                             @"type" : @"1"
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/cms-api/praiseAttent/cancelPraiseOrCollect.json",nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST
                                        URLString:urlString
                                       parameters:params
                                         finished:^(BOOL isSuccessed,
                                                    id result,
                                                    NSString *codeType,
                                                    NSString *errorMessage) {
                                             
                                             if (isSuccessed) {
                                                 [[SEGAnalyseBehaviorManager sharedManager] requestIntegralGrowthWithCode:SEGIntegralCode.cancelLike finished:^(BOOL isSuccessed, id result, NSString* codeType, NSString* errorMessage) {
                                                 }];

                                             }
                                             finished(isSuccessed, result, codeType, errorMessage);
                                             
                                         }];
}

#pragma mark - 线下活动
/**
 * 查询线下活动剩余名额
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestQueryOffLinePerCountByActId:(NSString *)actId
                                    actObj:(NSString *)actObj
                                  finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"actId" : actId,
                             @"offlineId" : actObj
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/queryOffLinePerCountById.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 if (isSuccessed) {
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSString* perCount = [dicData valueForKey:@"perCount"];
                                                     if (perCount) {
                                                         if ([dicData valueForKey:@"applyAuditStatus"]) {
                                                             self.applyAuditStatus = [[dicData valueForKey:@"applyAuditStatus"] intValue];
                                                         }
                                                         self.offlineLiftCount = ValueToString(perCount);
                                                         finished(YES, result, codeType, ValueToString(perCount));
                                                         return;
                                                     }else {
                                                         finished(NO, result, codeType, message);
                                                         return;
                                                     }
                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 线下活动报名
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestOffLineApplyByActId:(NSString *)actId
                            actObj:(NSString *)actObj
                          userName:(NSString *)userName
                           userSex:(NSString *)userSex
                           userTel:(NSString *)userTel
                        applyCount:(NSString *)applyCount
                            remark:(NSString *)remark
                          finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSMutableArray *houseIds = [NSMutableArray array];
    [profile.houseList enumerateObjectsUsingBlock:^(SEGProfileHouselistModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [houseIds addObject:obj.houseId];
    }];
    NSDictionary* params = @{
                             @"actId" : actId,
                             @"offlineId" : actObj,
                             @"userName" : userName,
                             @"userSex" : userSex,
                             @"userTel" : userTel,
                             @"applyCount" : applyCount,
                             @"remark" : remark,
                             @"userId" : kAccountUserID,
                             @"communityId" : kAccountCommunityID,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId),
                             @"houseIds" : houseIds
                             };

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/act-api/actvityBehavior/offLineApply.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                             }];
}

/**
 * 查询我的线下活动邀请函信息
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestQueryInvitationByActId:(NSString *)actId
                             finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"actId" : actId
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/queryInvitation.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSDictionary* data = [dicData valueForKey:@"invitation"];
                                                     if (data && [data isKindOfClass:[NSDictionary class]]) {
                                                         self.invitationModel = [SEGActivityInvitaionModel initWithDictionary:data];
                                                         finished(YES, result, code, message);
                                                         return;
                                                     }else {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

#pragma mark - 抽奖类
/**
 * 查询抽奖活动功能主体
 * @author Wendy
 * @param lotteryId 抽奖实例ID
 * @param isLotteryAct 是否是抽奖活动1:是2：否
 * @param finished 回调结果
 */
- (void)requestLotteryByLotteryId:(NSString *)lotteryId
                     isLotteryAct:(NSString *)isLotteryAct
                         finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"isLotteryAct" : isLotteryAct,
                             @"lotteryId" : lotteryId,
                             @"userId" : kAccountUserID
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/queryLotteryById.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSDictionary* data = [dicData valueForKey:@"lotteryDetailInfo"];
                                                     if (data && [data isKindOfClass:[NSDictionary class]]) {
                                                         self.lotteryDetailModel = [SEGActivityLotteryDetailModel initWithDictionary:data];
                                                         finished(YES, result, code, message);
                                                         return;
                                                     }else {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }

                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 用户抽奖
 * @author Wendy
 * @param actId 活动ID
 * @param triggerEventId 触发事件ID若为抽奖活动本身触发则为0
 * @param lotteryId 抽奖实例ID
 * @param finished 回调结果
 */
- (void)requestUserLotteryByActId:(NSString *)actId
                   triggerEventId:(NSString *)triggerEventId
                        lotteryId:(NSString *)lotteryId
                         finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* params = @{
                             @"actId" : actId,
                             @"triggerEventId" : triggerEventId,
                             @"lotteryId" : lotteryId,
                             @"userId" : kAccountUserID,
                             @"communityId" : kAccountCommunityID,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId)
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/actvityBehavior/userLottery.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSDictionary* data = [dicData valueForKey:@"lotteryResult"];
                                                     if (data && [data isKindOfClass:[NSDictionary class]]) {
                                                         self.lotteryResultModel = [SEGActivityLotteryResultModel initWithDictionary:data];
                                                         finished(YES, result, code, message);
                                                         return;
                                                     }else {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }

                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

#pragma mark - 签到类

/**
 * 查询签到活动主体信息
 * @author Wendy
 * @param signId 签到活动实例ID
 * @param finished 回调结果
 */
- (void)requestQuerySignBySignId:(NSString *)signId
                        finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"signId" : signId,
                             @"userId" : kAccountUserID
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/querySignById.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     self.signModel = [SEGActivitySignModel initWithDictionary:dicData];
                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 用户签到
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestSignByActId:(NSString *)actId
                  finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* params = @{
                             @"actId" : actId,
                             @"userId" : kAccountUserID,
                             @"communityId" : kAccountCommunityID,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId)
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/actvityBehavior/sign.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                            
                                                 if (isSuccessed) {
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, codeType, errorMessage);
                                                         return;
                                                     }
                                                     self.userSignModel = [SEGSignModel yy_modelWithDictionary:dicData[@"award"]];
                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

#pragma mark - 中奖记录
/**
 * 查询我的中奖记录
 * @author Wendy
 * @param finished 回调结果
 */
- (void)requestQueryWinnerRecordBypageNo:(NSInteger)pageNo
                                finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"pageNo" : @(pageNo)
                             };
    
    __block NSInteger _pageNo = pageNo;
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/queryWinnerRecordByUser.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSArray* list = [dicData valueForKey:@"winnerRecords"];
                                                     
                                                     if (!list || ![list isKindOfClass:[NSArray class]]) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     if (_pageNo != 1 && [list isKindOfClass:[NSArray class]] && list.count == 0) {
                                                         finished(NO, result, code, @"没有更多的数据！");
                                                         return;
                                                     }
                                                     
                                                     NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:list.count];
                                                     for (NSDictionary* dic in list) {
                                                         SEGWinRecordModel* _model = [SEGWinRecordModel initWithDictionary:dic];
                                                         [arrM addObject:_model];
                                                     }
                                                     
                                                     if (_pageNo == 1) { //顶部刷新
                                                         self.winRecordsArray = @[];
                                                     }
                                                     
                                                     NSMutableArray* _tmpData = [NSMutableArray arrayWithArray:self.winRecordsArray];
                                                     [_tmpData addObjectsFromArray:arrM];
                                                     
                                                     self.winRecordsArray = _tmpData;
                                                     
                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 查询中奖记录详情
 * @author Wendy
 * @param finished 回调结果
 */
- (void)requestQueryWinnerRecordByWinnerId:(NSString *)winnerId
                                  finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"winnerId" : winnerId
                             };

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/queryWinnerRecordDetail.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 NSString* code = codeType;
                                                 NSString* message = errorMessage;
                                                 
                                                 if (isSuccessed) {
                                                     
                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }
                                                     
                                                     NSDictionary* data = [dicData valueForKey:@"winnerDetail"];
                                                     if (data && [data isKindOfClass:[NSDictionary class]]) {
                                                         self.recordDetailModel = [SEGWinRecordDetailModel initWithDictionary:data];
                                                         finished(YES, result, code, message);
                                                         return;
                                                     }else {
                                                         finished(NO, result, code, message);
                                                         return;
                                                     }

                                                 }
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 提交充值手机号
 * @author Wendy
 * @param finished 回调结果
 */
- (void)requestSubmitRechargeTelByWinnerId:(NSString *)winnerId
                               rechargeTel:(NSString *)rechargeTel
                                  finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"winnerId" : winnerId,
                             @"rechargeTel" : rechargeTel
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/actvityBehavior/submitRechargeTel.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}

/**
 * 用户进行业务操作后,异步调用本接口，若有抽奖则发送消息队列消息，将抽奖实例发送给队列,同时,针对征集类，调查类，触发类，需要添加活动参与记录
 * @author Wendy
 * @param eventName 事件名 事件名包含：
 topic:参与话题
 reply-daily:回复日报
 purchanceProduct:购买商品
 joinwj:提交问卷
 postForHelp:帮帮发帖
 marktForHelp:集市发帖
 openDoor:手机开门
 payManagementFee:物业缴费
 repair:维修保障
 join:参加活动
 msg:留言
 like:点赞
 share:分享
 sign3:签到3天
 sign5:签到5天
 sign7:签到7天
 * @param eventValue 事件值
 当事件名为topic,reply-daily,purchanceProduct,joinwj 时，对应的事件值为话题ID,日报ID,商品ID,问卷ID
 当事件名为postForHelp,marktForHelp,openDoor,payManagementFee,repair时,事件值为0
 当事件名为其他取值时,事件值为对应的活动ID
 * @param finished 回调结果
 */
- (void)requestSubmitEventWithEventName:(NSString *)eventName eventValue:(NSString *)eventValue finished:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* params = @{
                             @"userId" : kAccountUserID,
                             @"communityId" : kAccountCommunityID,
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId),
                             @"eventName" : eventName?:@"",
                             @"eventValue" : eventValue?:@""
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/actvityBehavior/event.json",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed,
                                                        id result,
                                                        NSString *codeType,
                                                        NSString *errorMessage) {
                                                 
                                                 finished(isSuccessed, result, codeType, errorMessage);
                                                 
                                             }];
}


/**
 * 检查活动是否未审核
 * @author Wendy
 * @param actId 活动ID
 * @param finished 回调结果
 */
- (void)requestCheckActivityUnauditWithActId:(NSString *)actId finished:(SEGNetworkReponse)finished
{
    NSDictionary* params = @{
                             @"actId" : actId
                             };
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/check.json", nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:urlString parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

/**
 *  请求钱包-新的添加模型的请求
 */
- (void)requestMyCardV2WithDict:(NSDictionary*)params Finished:(SEGNetworkReponse)finished {
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/",kUhomecp_sso, @"/v1/balalce/getBanalces", nil];
    [SEGHTTPBusinessManager seg_requestWithMethod:POST URLString:urlString parameters:params finished:^(BOOL isSuccessed, id result, NSString* codeType, NSString* errorMessage) {
        if (!isSuccessed) {
            finished(NO, result, codeType, errorMessage);
            return ;
        }
        NSArray* data = [result valueForKey:@"data"];
        if (![data isKindOfClass:[NSArray class]]) {
            finished(NO, result, @"-1", @"暂时没有数据");
            return;
        }
        NSMutableArray* arrM = [NSMutableArray arrayWithCapacity:data.count];
        for (NSDictionary* dic in data) {
            SEGBanalcesModel* _model = [SEGBanalcesModel yy_modelWithDictionary:dic];
            [arrM addObject:_model];
        }
        self.seg_segbanalcesmodel = arrM;
        finished(YES, result, codeType, errorMessage);
    }];
}


/**
 * 查询首页是否显示签到按钮
 * @author Wendy
 * @param finished 回调结果
 */
- (void)requestIsSignShow:(SEGNetworkReponse)finished
{
    SEGProfileModel *profile = [SEGProfileManager sharedManager].profile;
    NSDictionary* params = @{
                             @"communityId" : ValueToString(profile.jobCommunity),
                             @"provinceId" : ValueToString(profile.provinceId),
                             @"cityId" : ValueToString(profile.cityId),
                             @"region" : ValueToString(profile.regionId)
                             };

    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL, @"/act-api/activityInfo/isSignShow.json",nil];
    
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST
                                            URLString:urlString
                                           parameters:params
                                             finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {

                                                 if (isSuccessed) {

                                                     NSDictionary* dicData = [result valueForKey:@"data"];
                                                     if ((!dicData) || (![dicData isKindOfClass:[NSDictionary class]])) {
                                                         finished(NO, result ,codeType, errorMessage);
                                                         return;
                                                     }
                                                 }
                                                 finished(isSuccessed, result ,codeType, errorMessage);

                                             }];
}

#pragma mark - getter
- (NSArray<SEGActivityListModel *> *)activityList
{
    if (!_activityList) {
        _activityList = [NSArray array];
    }
    return _activityList;
}

- (SEGActivityDetailModel *)detailModel
{
    if (!_detailModel) {
        _detailModel = [[SEGActivityDetailModel alloc] init];
    }
    return _detailModel;
}
- (NSArray<SEGActivityDetailCommentModel *> *)commentsArray
{
    if (!_commentsArray) {
        _commentsArray = [NSArray array];
    }
    return _commentsArray;
}
- (SEGActivityDetailCommentDetailModel *)commentDetailModel
{
    if (!_commentDetailModel) {
        _commentDetailModel = [[SEGActivityDetailCommentDetailModel alloc] init];
    }
    return _commentDetailModel;
}
- (NSArray<SEGActivityDetailCommentAnswModel *> *)commentAnswerList
{
    if (!_commentAnswerList) {
        _commentAnswerList = [NSArray array];
    }
    return _commentAnswerList;
}
- (NSArray<SEGActivityMyUploadModel *> *)myCommentsList
{
    if (!_myCommentsList) {
        _myCommentsList = [NSArray array];
    }
    return _myCommentsList;
}
- (SEGActivitySignModel *)signModel
{
    if (!_signModel) {
        _signModel = [[SEGActivitySignModel alloc] init];
    }
    return _signModel;
}
- (NSArray<SEGWinRecordModel *> *)winRecordsArray
{
    if (!_winRecordsArray) {
        _winRecordsArray = [NSArray array];
    }
    return _winRecordsArray;
}
- (SEGWinRecordDetailModel *)recordDetailModel
{
    if (!_recordDetailModel) {
        _recordDetailModel = [[SEGWinRecordDetailModel alloc] init];
    }
    return _recordDetailModel;
}
- (SEGActivityLotteryResultModel *)lotteryResultModel
{
    if (!_lotteryResultModel) {
        _lotteryResultModel = [[SEGActivityLotteryResultModel alloc] init];
    }
    return _lotteryResultModel;
}
- (SEGActivityInvitaionModel *)invitationModel
{
    if (!_invitationModel) {
        _invitationModel = [[SEGActivityInvitaionModel alloc] init];
    }
    return _invitationModel;
}
- (NSArray<SEGBanalcesModel *> *)seg_segbanalcesmodel {
    if (!_seg_segbanalcesmodel) {
        _seg_segbanalcesmodel = [NSArray array];
    }
    return _seg_segbanalcesmodel;
}

@end

